package cn.com.headfree.entity.isc;

import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;

/**  
 * @Title  TimestampSerializer.java   
 * @Package cn.com.headfree.entity.isc   
 * @Description TODO
 * @author yangwang 
 * @date  2020年8月4日 下午5:42:50   
 */
public class TimestampSerializer extends JsonSerializer<Timestamp>{
	private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

	  public void serialize(Timestamp arg0, JsonGenerator arg1, SerializerProvider arg2)
	    throws IOException, JsonProcessingException
	  {
	    arg1.writeString(String.valueOf(this.dateFormat.format(arg0)));
	  }

	  public Class<Timestamp> handledType()
	  {
	    return Timestamp.class;
	  }
}
